<template>
  <div>
    <!--修改用户对话框-->
    <el-dialog
            title="添加用户"
            :visible.sync="dialogEditorVisible"
            width="30%">


      <!--form-->
      <el-form :model="editorUserForm" :rules="editorUserFormRules" ref="addUserFormRef" label-width="70px">
        <el-form-item label="用户名" prop="username">
          <el-input v-model="editorUserForm.username" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="邮箱" prop="email">
          <el-input v-model="editorUserForm.email" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="手机" prop="phone">
          <el-input v-model="editorUserForm.phone" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <!--footer-->
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="addUSer">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    name: "EditorDialog",
    data() {
      
      return {
        editorUserForm: {
          username: '',
          password: '',
          email: '',
          phone: ''
        },
        dialogEditorVisible: false,
      }
    },
    methods: {
      // UserForm 规则
      editorUserFormRules: {
        email: [
          { required: true, message: '邮箱不能为空',trigger: 'blur'},
          {validator: checkEmail,trigger: 'blur'},
        ],
        phone: [
          { required: true, message: '手机不能为空',trigger: 'blur'},
          {validator: checkPhone ,trigger: 'blur'}
        ]
      },
    }
  }
</script>

<style scoped>

</style>